package com.mashuai.utils.ztest.toolkit.msDataSource;

import com.mashuai.utils.toolkit.core.msDataSource.dto.MsDataSourceMsgDto;
import com.mashuai.utils.toolkit.inter.IMsRegisterDataSource;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;

/**
 * @ClassName: MsRegisterDataSource
 * @Author : mashuai
 * @Description: TODO
 */
@Component("myDataSourceMsg")//保证注入ioc的bean名称必须是myDataSourceMsg即可
public class MyDataSourceMsgTest implements IMsRegisterDataSource {
    @Override
    public Map<String, MsDataSourceMsgDto> getDataSourceMsg() {
        HashMap<String, MsDataSourceMsgDto> map = new HashMap<>();
        //添加第一个主数据源，10.88.15.37默认为主数据源，
        MsDataSourceMsgDto db1 = new MsDataSourceMsgDto(
                "jdbc:mysql://10.88.15.37:3306/syncplant_ms?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&tinyInt1isBit=false&allowMultiQueries=true&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true&rewriteBatchedStatements=true",
                "root",
                "root",
                true);
        map.put("db1", db1);
        //添加从数据源，10.44.2.3
        MsDataSourceMsgDto db2 = new MsDataSourceMsgDto(
                "jdbc:mysql://10.44.2.3:3306/syncplant_ms?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&tinyInt1isBit=false&allowMultiQueries=true&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true&rewriteBatchedStatements=true",
                "root",
                "root");
        map.put("db2", db2);
        return map;
    }
}
